package net.sk.china.platform.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sk.china.platform.request.express.ShippingTemplatesRegionRequest;
import net.sk.china.platform.service.express.ShippingTemplatesRegionService;
import net.sk.china.common.response.CommonResult;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *  物流付费前端控制器
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/4 13:18
 * +----------------------------------------------------------------------
 */
@RestController
@RequestMapping("express/shipping/region")
@Api(tags = "设置 -- 物流 -- 付费")
public class ShippingTemplatesRegionController {

    private final ShippingTemplatesRegionService shippingTemplatesRegionService;

    public ShippingTemplatesRegionController(ShippingTemplatesRegionService shippingTemplatesRegionService) {
        this.shippingTemplatesRegionService = shippingTemplatesRegionService;
    }

    /**
     * 根据模板id查询数据
     * @param tempId Integer 模板id
     */
    @PreAuthorize("hasAuthority('admin:shipping:templates:region:list')")
    @ApiOperation(value = "根据模板id查询数据")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<List<ShippingTemplatesRegionRequest>> getList(@RequestParam Integer tempId){
        return CommonResult.success(shippingTemplatesRegionService.getListGroup(tempId));
    }
}
